home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / Projects / Questions & Answers / Q&A Programming Functions / Triggering musical phrases < prev    next >
Encoding:
Text File  |  1998-10-26  |  6.2 KB  |  143 lines  |  [TEXT/ScoM]

  1. TRIGGERING MUSICAL PHRASES
  2.  
  3. >what is the best way to have certain specific list items trigger musical
  4. >phrases?
  5. >
  6. >for example.
  7. >
  8. >(def-length
  9. >
  10. >    hihat '(1/4 1/4 1/8 1/8 1/4)
  11. >
  12. >)
  13. >
  14. >
  15. >suppose now that i want item number four to trigger hihat 2 playing a
  16. >list generated by gen-sin. i could of course define zones and lengths
  17. >manually but this is rather tedious if there are many zones. is there a
  18. >function so i can do something like this:
  19. >
  20. >(setq rhytm lista listb lista listc (starting on the fifteenth note of
  21. >listb, play listx))
  22. >
  23. >(def zone (make-zone lista) (make-zone listb) ...etcetera)
  24.  
  25. I would first try zone mechanism. Define instrument which zones are 
  26. (1/4 1/4 1/8 1/8 1/4). Then, define symbol and other slot values as 
  27. sublists
  28.  
  29. ((material for zone1) (material for zone2) ...)
  30.  
  31. Each material will start playing at time position determined by
  32. the zones. Notice that this solution does not allow overlapping
  33. material. To make such, each material must be allocated for an
  34. instrument and then use rest zone and the length of the zone of
  35. the material to be played, like (-16/1 1/1) -- this makes 16 bars
  36. empty and then plays one bar. This is a way to throw events in
  37. time. You can construct the zone list also by algorithms and so
  38. you can define events that will occur in random position in time
  39. or determined by lets say division series or something as cool...
  40.  
  41. >> I would first try zone mechanism. Define instrument which zones are
  42. >> (1/4 1/4 1/8 1/8 1/4). Then, define symbol and other slot values as
  43. >> sublists
  44. >>
  45. >
  46. >ok. so far i am completely with you. i guess what i am after is constructing
  47. >an engine which will manipulate a predefined set of sequences according to a
  48. >few variables, which can be changed easily to try new combinations.
  49. >
  50. >suppose there are three sequences, say (seq1 '(1/8 1/8 1/4 1/8)) and (seq2
  51. >'(1/16 1/4 1/8)) and (seq 3 '(1/16 1/16 1/16 1/16 1/16 1/16 1/16)).
  52. >now play seq1 and on the 3d note start playing seq3 while still looping seq1
  53. >then on the 5th note of seq 3 start playing seq 2 then on 7th note of seq3
  54. >stop seq1 etcetera. this can of course be specified zone for zone like you
  55. >said. but i would prefer to be able to quickly change things around, insert
  56. >a gen-sin here and so forth. the time sheet would be ideal if only the
  57. >resolution would not be fixed for all tracks, so it wont work with patterns
  58. >of uneven lengths.
  59. >
  60. >so far the best alternative seems to be neurons, i just started looking at
  61. >them. or is there another way? the thing i keep getting caught on is that i
  62. >like to combine patterns of all kinds of time signatures. most sequencers
  63. >like to stay in 4/4.
  64.  
  65. You have to program a preprocessor. Neurons might work but if they don't
  66. then you need to do it in Lisp. This shows you principles how to program
  67. preprocessors. This returns you a zoned list of elements for a given
  68. number of zones when you know the length pattern. What it does is
  69. accumulates length values and stacks symbols until zone value is reached
  70. and then pushes the stack on storage, which is returned when the last
  71. zone is processed. There are some cases which complicate the process
  72. and that is when the symbols are a zoned list. Length pattern is here
  73. always a flat list.
  74.  
  75. ; (symbol-divide-zone2 '(1 2 3 4 5) '(1/16) '(1/1 1/1 1/1)) 
  76. ; ((1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1) (2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2) (3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3))
  77. ; (symbol-divide-zone2 '(a b c d e f g) '(1/16) '(1/2 1/2))
  78. ; ((a b c d e f g a) (b c d e f g a b))
  79. ; (symbol-divide-zone2 '(a b c d e f g) '(1/4) '(1/2 -1/2 1/2))
  80. ; ((a b) nil (c d))
  81. ; (symbol-divide-zone2 '(= b c) '(1/8 1/16 1/16) '(5/8))
  82. ; ((= b c = b c =))
  83. ; the following makes also this work properly
  84. ; (symbol-divide-zone2 '((1 2 3) (3 4) (5 6)) '(1/4) '(1/1 1/1 1/1))
  85. ; ((1 2 3 1) (3 4 3 4) (5 6 5 6))
  86. ; (symbol-divide-zone2 '((1 2 3) (3 4) (5 6)) '(1/4) '(1/1 -1/1 1/1))
  87. ; ((1 2 3 1) nil (5 6 5 6))
  88.  
  89. (defun symbol-divide-zone2 (symbols lengths zones)
  90.   (prog (current-master current-symbols flat symbol-list counts out zone-len collect len-list master-symbol-list symbol-list)
  91.     (unless (listp (car symbols))
  92.       (setq flat t)
  93.       (setq symbols (list symbols)))
  94.     (setq symbol-list symbols)
  95.     (setq master-symbol-list symbols)
  96.     (setq current-symbols (car symbol-list))
  97.     (setq current-master current-symbols)
  98.     (setq symbol-list (cdr symbol-list))
  99.     (if (null symbol-list) (setq symbol-list symbols))
  100.     (setq counts 0)
  101.     (setq len-list lengths)
  102.      (while zones
  103.      (setq zone-len (- (get-tick (car zones)) counts))
  104.      (cond ((<= zone-len 0)
  105.             (push nil out)
  106.             (setq counts 0)
  107.             (setq zone-len 0)
  108.             (setq zones (cdr zones))
  109.             (unless flat
  110.               (setq current-symbols (car symbol-list))
  111.               (setq current-master current-symbols)
  112.               (setq symbol-list (cdr symbol-list))
  113.               (when (null symbol-list)
  114.                 (setq symbol-list master-symbol-list))))
  115.            (t (setq collect nil)
  116.               (setq counts 0)
  117.               (while (< counts zone-len)
  118.                 (push (car current-symbols) collect)
  119.                 (setq current-symbols (cdr current-symbols))
  120.                 (when (null current-symbols)
  121.                   (setq current-symbols current-master))
  122.                 (setq counts (+ counts (abs (get-tick (car len-list)))))
  123.                 (setq len-list (cdr len-list))
  124.                 (when (null len-list)
  125.                   (setq len-list lengths)))
  126.               (push (nreverse collect) out)
  127.               (unless flat
  128.                 (setq current-symbols (car symbol-list))
  129.                 (setq current-master current-symbols)
  130.                 (setq symbol-list (cdr symbol-list))
  131.                 (when (null symbol-list)
  132.                   (setq symbol-list master-symbol-list)))
  133.               (setq zones (cdr zones))))
  134.      (setq counts (- counts zone-len)))
  135.     (return (nreverse out))))
  136.  
  137. Notice that def-section-timesheets allows multiple resolutions in
  138. timesheet although the column resolution is equal to them. But
  139. each instrument will continue cycling through the zone boundaries and
  140. so you can start and stop it playing by the timesheet string. If you
  141. want the same instrument to play in different time position then 
  142. group instruments to consist of several partials in def-orchestra.
  143.